//package office.word.aspose;
//
//import com.aspose.words.*;
//
//import java.util.Date;
//
///**
// * 描述
// *
// * @author: zhanglu
// * @date: 2023/7/21 12:49
// * @modify: 修改人信息, 修改内容 2023/7/21 12:49
// */
//public class DiffTest {
//
//    public static void main(String[] args) throws Exception {
//        Document docOriginal = new Document("/Users/zhanglu/Desktop/tmp/aspose/test/doc01.docx");
//        Document docEdited = new Document("/Users/zhanglu/Desktop/tmp/aspose/test/doc02.docx");
//        CompareOptions compareOptions = new CompareOptions();
//        compareOptions.setIgnoreFormatting(false);
//        compareOptions.setIgnoreCaseChanges(false);
//        compareOptions.setIgnoreComments(true);
//        compareOptions.setIgnoreTables(false);
//        compareOptions.setIgnoreFields(true);
//        compareOptions.setIgnoreFootnotes(true);
//        compareOptions.setIgnoreTextboxes(true);
//        compareOptions.setIgnoreHeadersAndFooters(true);
//        compareOptions.setTarget(ComparisonTargetType.NEW);
//        compareOptions.setGranularity(Granularity.CHAR_LEVEL);
//
//        docOriginal.compare(docEdited, "John Doe", new Date(), compareOptions);
//        docOriginal.save("/Users/zhanglu/Desktop/tmp/aspose/test/diff.docx");
//        docOriginal.save("/Users/zhanglu/Desktop/tmp/aspose/test/diff.pdf", SaveFormat.PDF);
//    }
//
////    public static void main(String[] args) throws Exception {
////        MatchLicense.init();
////        // Create the original document and populate it with various kinds of elements.
////        Document docOriginal = new Document();
////        DocumentBuilder builder = new DocumentBuilder(docOriginal);
////
////        // Paragraph text referenced with an endnote:
////        builder.writeln("Hello world! This is the first paragraph.");
////        builder.insertFootnote(FootnoteType.ENDNOTE, "Original endnote text.");
////
////        // Table:
////        builder.startTable();
////        builder.insertCell();
////        builder.write("Original cell 1 text");
////        builder.insertCell();
////        builder.write("Original cell 2 text");
////        builder.endTable();
////
////        // Textbox:
////        Shape textBox = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 20.0);
////        builder.moveTo(textBox.getFirstParagraph());
////        builder.write("Original textbox contents");
////
////        // DATE field:
////        builder.moveTo(docOriginal.getFirstSection().getBody().appendParagraph(""));
////        builder.insertField(" DATE ");
////
////        // Comment:
////        Comment newComment = new Comment(docOriginal, "John Doe", "J.D.", new Date());
////        newComment.setText("Original comment.");
////        builder.getCurrentParagraph().appendChild(newComment);
////
////        // Header:
////        builder.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY);
////        builder.writeln("Original header contents.");
////
////        // Create a clone of our document and perform a quick edit on each of the cloned document's elements.
////        Document docEdited = (Document) docOriginal.deepClone(true);
////        Paragraph firstParagraph = docEdited.getFirstSection().getBody().getFirstParagraph();
////
////        firstParagraph.getRuns().get(0).setText("hello world! this is the first paragraph, after editing.");
////        firstParagraph.getParagraphFormat().setStyle(docEdited.getStyles().getByStyleIdentifier(StyleIdentifier.HEADING_1));
////        ((Footnote) docEdited.getChild(NodeType.FOOTNOTE, 0, true)).getFirstParagraph().getRuns().get(1).setText("Edited endnote text.");
////        ((Table) docEdited.getChild(NodeType.TABLE, 0, true)).getFirstRow().getCells().get(1).getFirstParagraph().getRuns().get(0).setText("Edited Cell 2 contents");
////        ((Shape) docEdited.getChild(NodeType.SHAPE, 0, true)).getFirstParagraph().getRuns().get(0).setText("Edited textbox contents");
////        ((FieldDate) docEdited.getRange().getFields().get(0)).setUseLunarCalendar(true);
////        ((Comment) docEdited.getChild(NodeType.COMMENT, 0, true)).getFirstParagraph().getRuns().get(0).setText("Edited comment.");
////        docEdited.getFirstSection().getHeadersFooters().getByHeaderFooterType(HeaderFooterType.HEADER_PRIMARY).getFirstParagraph().getRuns().get(0).setText("Edited header contents.");
////
////        // Comparing documents creates a revision for every edit in the edited document.
////        // A CompareOptions object has a series of flags that can suppress revisions
////        // on each respective type of element, effectively ignoring their change.
////        CompareOptions compareOptions = new CompareOptions();
////        compareOptions.setIgnoreFormatting(false);
////        compareOptions.setIgnoreCaseChanges(false);
////        compareOptions.setIgnoreComments(true);
////        compareOptions.setIgnoreTables(true);
////        compareOptions.setIgnoreFields(true);
////        compareOptions.setIgnoreFootnotes(true);
////        compareOptions.setIgnoreTextboxes(true);
////        compareOptions.setIgnoreHeadersAndFooters(true);
////        compareOptions.setTarget(ComparisonTargetType.NEW);
////        compareOptions.setGranularity(Granularity.CHAR_LEVEL);
////
////        docOriginal.compare(docEdited, "John Doe", new Date(), compareOptions);
////        docOriginal.save("/Users/zhanglu/Desktop/tmp/aspose/test/diff.docx");
////    }
//
//}
